From 6136b2fee4795a96144a0176daac9a322e3641d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Mon, 1 May 2006 21:17:31 +0000 Subject: [PATCH] * Bidi-aid on list pages * Some lists with bidi titles should be more readable now --- RELEASE-NOTES | 1 + includes/GlobalFunctions.php | 6 ++++++ includes/SpecialAncientpages.php | 2 +- includes/SpecialCategories.php | 2 +- includes/SpecialListusers.php | 9 ++++----- includes/SpecialMostcategories.php | 2 +- includes/SpecialMostimages.php | 2 +- includes/SpecialMostlinked.php | 2 +- includes/SpecialMostlinkedcategories.php | 2 +- includes/SpecialMostrevisions.php | 2 +- includes/SpecialPopularpages.php | 2 +- includes/SpecialWantedcategories.php | 2 +- includes/SpecialWantedpages.php | 4 ++-- languages/Language.php | 1 + 14 files changed, 23 insertions(+), 16 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 853cd1f27d..b50ecfcade 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -182,6 +182,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 361) URL in URL, they were almost fixed. Now they are. * (bug 4876) Add __NEWSECTIONLINK__ magic word to force the "new section" link/tab to show up on specific pages on demand +* Bidi-aid on list pages == Compatibility == diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index d30dd97197..59a8191817 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1621,6 +1621,12 @@ function in_string( $needle, $str ) { return strpos( $str, $needle ) !== false; } +function wfSpecialList( $page, $details ) { + global $wgContLang; + $details = $details ? $wgContLang->getDirMark() . " ($details)" : ""; + return $page . $details; +} + /** * Returns a regular expression of url protocols * diff --git a/includes/SpecialAncientpages.php b/includes/SpecialAncientpages.php index f25caf4f5a..a0fcef7a0a 100644 --- a/includes/SpecialAncientpages.php +++ b/includes/SpecialAncientpages.php @@ -55,7 +55,7 @@ class AncientPagesPage extends QueryPage { $d = $wgLang->timeanddate( wfTimestamp( TS_MW, $result->value ), true ); $title = Title::makeTitle( $result->namespace, $result->title ); $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) ); - return "{$link} ({$d})"; + return wfSpecialList($link, $d); } } diff --git a/includes/SpecialCategories.php b/includes/SpecialCategories.php index ccfd369e6b..45d266a639 100644 --- a/includes/SpecialCategories.php +++ b/includes/SpecialCategories.php @@ -53,7 +53,7 @@ class CategoriesPage extends QueryPage { $title = Title::makeTitle( NS_CATEGORY, $result->title ); $plink = $skin->makeLinkObj( $title, $title->getText() ); $nlinks = wfMsg( 'nlinks', $result->count ); - return "$plink ($nlinks)"; + return wfSpecialList($plink, $nlinks); } } diff --git a/includes/SpecialListusers.php b/includes/SpecialListusers.php index 17cc923ee1..46244a374b 100644 --- a/includes/SpecialListusers.php +++ b/includes/SpecialListusers.php @@ -176,6 +176,7 @@ class ListUsersPage extends QueryPage { function formatResult( $skin, $result ) { $userPage = Title::makeTitle( $result->namespace, $result->title ); $name = $skin->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) ); + $groups = null; if( !isset( $result->numgroups ) || $result->numgroups > 0 ) { $dbr =& wfGetDB( DB_SLAVE ); @@ -190,14 +191,12 @@ class ListUsersPage extends QueryPage { $dbr->freeResult( $result ); if( count( $groups ) > 0 ) { - $name .= ' (' . - $skin->makeLink( wfMsgForContent( 'administrators' ), - htmlspecialchars( implode( ', ', $groups ) ) ) . - ')'; + $groups = $skin->makeLink( wfMsgForContent( 'administrators' ), + htmlspecialchars( implode( ', ', $groups ) ) ); } } - return $name; + return wfSpecialList($name, $groups); } } diff --git a/includes/SpecialMostcategories.php b/includes/SpecialMostcategories.php index 17dbb5d60a..2a188d9ed2 100644 --- a/includes/SpecialMostcategories.php +++ b/includes/SpecialMostcategories.php @@ -50,7 +50,7 @@ class MostcategoriesPage extends QueryPage { $nl = wfMsg( 'ncategories', $result->value ); $nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Categories' ), $nl, 'article=' . $nt->getPrefixedURL() ); - return "{$plink} ({$nlink})"; + return wfSpecialList($plink, $nlink); } } diff --git a/includes/SpecialMostimages.php b/includes/SpecialMostimages.php index 5a072a5bc0..a10e5a1fc3 100644 --- a/includes/SpecialMostimages.php +++ b/includes/SpecialMostimages.php @@ -48,7 +48,7 @@ class MostimagesPage extends QueryPage { $nl = wfMsg( 'nlinks', $result->value ); $nlink = $skin->makeKnownLink( $nt->getPrefixedText() . '#filelinks', $nl ); - return "$plink ($nlink)"; + return wfSpecialList($plink, $nlink); } } diff --git a/includes/SpecialMostlinked.php b/includes/SpecialMostlinked.php index 6b518606bb..88a85a5cb0 100644 --- a/includes/SpecialMostlinked.php +++ b/includes/SpecialMostlinked.php @@ -58,7 +58,7 @@ class MostlinkedPage extends QueryPage { $nl = wfMsg( 'nlinks', $result->value ); $nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Whatlinkshere' ), $nl, 'target=' . $nt->getPrefixedURL() ); - return "{$plink} ({$nlink})"; + return wfSpecialList($plink, $nlink); } } diff --git a/includes/SpecialMostlinkedcategories.php b/includes/SpecialMostlinkedcategories.php index 2f6f2b0e3c..a3b1562a1c 100644 --- a/includes/SpecialMostlinkedcategories.php +++ b/includes/SpecialMostlinkedcategories.php @@ -65,7 +65,7 @@ class MostlinkedCategoriesPage extends QueryPage { $plink = $skin->makeLinkObj( $nt, htmlspecialchars( $text ) ); $nlinks = wfMsg( 'nlinks', $result->value ); - return "$plink ($nlinks)"; + return wfSpecialList($plink, $nlinks); } } diff --git a/includes/SpecialMostrevisions.php b/includes/SpecialMostrevisions.php index 6bc807e4cf..c8a04a546f 100644 --- a/includes/SpecialMostrevisions.php +++ b/includes/SpecialMostrevisions.php @@ -52,7 +52,7 @@ class MostrevisionsPage extends QueryPage { $nl = wfMsg( 'nrevisions', $result->value ); $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' ); - return "$plink ($nlink)"; + return wfSpecialList($plink, $nlink); } } diff --git a/includes/SpecialPopularpages.php b/includes/SpecialPopularpages.php index 7a9557daa5..e5242c35db 100644 --- a/includes/SpecialPopularpages.php +++ b/includes/SpecialPopularpages.php @@ -45,7 +45,7 @@ class PopularPagesPage extends QueryPage { $title = Title::makeTitle( $result->namespace, $result->title ); $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) ); $nv = wfMsg( "nviews", $wgLang->formatNum( $result->value ) ); - return "{$link} ({$nv})"; + return wfSpecialList($link, $nv); } } diff --git a/includes/SpecialWantedcategories.php b/includes/SpecialWantedcategories.php index b78e0ae8cc..df152aaa97 100644 --- a/includes/SpecialWantedcategories.php +++ b/includes/SpecialWantedcategories.php @@ -69,7 +69,7 @@ class WantedCategoriesPage extends QueryPage { $skin->makeBrokenLinkObj( $nt, htmlspecialchars( $text ) ); $nlinks = wfMsg( 'nlinks', $result->value ); - return "$plink ($nlinks)"; + return wfSpecialList($plink, $nlinks); } } diff --git a/includes/SpecialWantedpages.php b/includes/SpecialWantedpages.php index dcae3eccc8..100c6c0f92 100644 --- a/includes/SpecialWantedpages.php +++ b/includes/SpecialWantedpages.php @@ -91,10 +91,10 @@ class WantedPagesPage extends QueryPage { # Make a link to "what links here" if it's required $wlhLink = $this->nlinks - ? " (" . $this->makeWlhLink( $title, $skin, wfMsgHtml( 'nlinks', $result->value ) ) . ")" + ? $this->makeWlhLink( $title, $skin, wfMsgHtml( 'nlinks', $result->value ) ) : ""; - return "{$pageLink}{$wlhLink}"; + return wfSpecialList($pageLink, $wlhLink); } /** diff --git a/languages/Language.php b/languages/Language.php index 50169a9627..17b5d12fc0 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -861,6 +861,7 @@ class Language { * @return bool */ function isRTL() { return false; } + function getDirMark() { return $this->isRTL() ? '‏' : '‎'; } /** * To allow "foo[[bar]]" to extend the link over the whole word "foobar" -- 2.20.1